import { spawn, exec } from './lib/cp';

const server = 'root@39.106.45.170';

const timer = new Date().toLocaleString();

const command = `cd build/webTemp; git pull; cp -r .git ../web; cd ../web; git add .; git commit -m '${timer}'; git push; ssh ${server} "cd ~/mp-ui/mp-ui-release; git checkout .; git pull; yarn install; pm2 delete mp-ui; pm2 start ecosystem.config.js; pm2 save;"`;

(async function deploy() {
  console.log(await exec(command));
})();
